/**
 * @Package: 	com.group.ForceLogoutUtils 
 * @author: 	Liu  
 * @date: 		Jan 3, 2019 10:53:49 AM 
 */
package com.group.ForceLogoutUtils;

import java.util.Enumeration;

import javax.servlet.http.HttpSession;

import com.group.Listener.SessionListener;

/**
 * @ClassName: ForceLogoutUtils.java
 * @Description: 强制用户下线
 * @author: Liu
 * @date: Jan 3, 2019 10:53:49 AM
 */
public class ForceLogoutUtils {
	/**
	 * @Function: 	 ForceLogoutUtils.java
	 * @Description: 强制用户下线
	 * @param:		 用户ID
	 * @return:		
	 * @author: 	 Liu
	 * @date:		 Jan 3, 2019 11:08:40 AM 
	 */
	public static void forceUserLogout(String userID) {
		if (SessionListener.sessionMap.get(userID) != null) {
			HttpSession session = SessionListener.sessionMap.get(userID);
			SessionListener.sessionMap.remove(userID);
			Enumeration e = session.getAttributeNames();
			while (e.hasMoreElements()) {
				String sessionName = (String) e.nextElement();
				session.removeAttribute(sessionName);
			}
			session.invalidate();
		}
	}
}
